package com.qianxun.model;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ServerCfg {
	private String name;
	private String hostIp;
	private int hostPort;
	private String remoteObjName;
	public ServerCfg(){
		InputStream in =  null;
		try {
			in = new FileInputStream("D:/DevelopeSpace/Trunk/qianxun/src/serverConfiger.properties");
			Properties props = new Properties();
			props.load(in);
			this.hostIp = props.getProperty("host_ip");
			this.hostPort = Integer.parseInt(props.getProperty("host_port"));
			this.remoteObjName = props.getProperty("remoteObjName");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
			
	}
	public String getHostIp() {
		return hostIp;
	}
	public void setHostIp(String hostIp) {
		this.hostIp = hostIp;
	}
	public int getHostPort() {
		return hostPort;
	}
	public void setHostPort(int hostPort) {
		this.hostPort = hostPort;
	}
	public String getName(){
		return this.name!=null?this.name:this.hostIp+":"+this.hostPort+"/"+this.remoteObjName;
	}
	public void setName(String name){
		this.name = name;
	}
}
